Sesión 03

Diseño de Bloques Completos al Azar


Christian Vásquez-Velasco, Bach., M.Sc.(c)

InkaStats Academy

2023

Planeamiento


Instalar paquetes necesarios


# install.packages("devtools")
# devtools::install_github("emitanaka/edibble", force = T)
# devtools::install_github("emitanaka/deggust", force = T)

if (!require("pacman")) install.packages("pacman")
pacman::p_load(readxl, agricolae, agricolaeplotr, car, tidyverse, PMCMRplus, outliers, nortest, mvtnorm, lmtest, ExpDes, edibble, gt,
               gtsummary, devtools, deggust, xlsx, desplot,
               ggResidpanel, fastGraph, gvlma)
package 'xlsx' successfully unpacked and MD5 sums checked

The downloaded binary packages are in
    C:\Users\cvasquezv\AppData\Local\Temp\RtmpygHH5o\downloaded_packages

Crear un libro con el paquete agricolae


variedades <- c("Amazon", "Coari x Lame", "Coari x Yangambí",
                "Unipalma")

r <- 5

salida <- agricolae::design.rcbd(trt = variedades,
                                 r = r,
                                 serie = 2,
                                 seed = 123,
                                 kinds = "Mersenne-Twister",
                                 first = TRUE,
                                 continue = FALSE,
                                 randomization = TRUE)

Sketch del diseño

salida$sketch
     [,1]               [,2]           [,3]               [,4]              
[1,] "Coari x Yangambí" "Unipalma"     "Amazon"           "Coari x Lame"    
[2,] "Coari x Yangambí" "Coari x Lame" "Unipalma"         "Amazon"          
[3,] "Coari x Yangambí" "Amazon"       "Coari x Lame"     "Unipalma"        
[4,] "Coari x Lame"     "Amazon"       "Unipalma"         "Coari x Yangambí"
[5,] "Unipalma"         "Amazon"       "Coari x Yangambí" "Coari x Lame"    
salida$book %>% 
  gt::gt() %>%
  gt::opt_interactive(use_search = TRUE,
                      use_filters = TRUE,
                      use_compact_mode = TRUE,
                      page_size_default = 5)

Sketch codificado del diseño

print(matrix(salida$book[,1], byrow=TRUE, ncol=4))
     [,1] [,2] [,3] [,4]
[1,]  101  102  103  104
[2,]  201  202  203  204
[3,]  301  302  303  304
[4,]  401  402  403  404
[5,]  501  502  503  504

Guardar el libro generado

write.table(salida$book, "books/rcbd.txt",
            row.names = FALSE, sep = "\t")

write.xlsx(salida$book, "books/rcbd.xlsx", sheetName = "book", append = FALSE, row.names = FALSE)

Libro de campo

fieldbook <- salida %>% 
  zigzag()

fieldbook %>%
  gt::gt() %>%
  gt::opt_interactive(use_search = TRUE,
                      use_filters = TRUE,
                      use_compact_mode = TRUE,
                      page_size_default = 5)

Guardar el libro de campo generado

write.table(fieldbook,
  "books/rcbd.txt",
  row.names = FALSE, sep = "\t")

write.xlsx(fieldbook,
  "books/rcbd.xlsx",
  sheetName = "book",
  append = FALSE,
  row.names = FALSE)
agricolaeplotr::plot_rcdb(design = salida,
                          factor_name = "variedades",
                          reverse_y = TRUE,
                          reverse_x = FALSE) +
  labs(fill = "Variedades",
       x = "Columnas",
       y = "Filas")

Crear un libro de campo con el paquete edibble


menu_rcbd()
design("Randomised Complete Block Design") %>%
  set_units(block = 8,
            unit = nested_in(block, 10)) %>%
  set_trts(trt = 10) %>%
  allot_trts(trt ~ unit) %>%
  assign_trts("random", seed = 937) %>%
  serve_table()
rcbd <- takeout(menu_rcbd(t = 4, r = 5, seed = 123))
rcbd %>% 
  gt::gt() %>%
  gt::opt_interactive(use_search = TRUE,
                      use_filters = TRUE,
                      use_compact_mode = TRUE,
                      page_size_default = 5)
rcbd2 <- design("Randomised Complete Block Design") %>%
  set_units(block = 5,
            unit = nested_in(block, 4)) %>%
  set_trts(variedades = c("Amazon", "Coari x Lame", "Coari x Yangambí", "Unipalma")) %>%
  allot_trts(variedades ~ unit) %>%
  assign_trts("random", seed = 123) %>%
  serve_table()
rcbd2 %>% 
  gt::gt() %>%
  gt::opt_interactive(use_search = TRUE,
                      use_filters = TRUE,
                      use_compact_mode = TRUE,
                      page_size_default = 5)
deggust::autoplot(rcbd)

Análisis del diseño


Importación de datos


archivos <- list.files(pattern = "ejercicio 1.xlsx", 
                       full.names = TRUE,
                       recursive = TRUE)

# Importación
data <- readxl::read_xlsx(archivos,
                           sheet = "Hoja1")

# Preprocesamiento

data <- data %>%
  mutate_if(is.character, factor)

Creación del modelo lineal


modelo.dbca <- lm(rdt ~ trt + `F` , data = data)

Definición del modelo


\[Y = \beta_0 + \beta_1*T_B + \beta_2*T_C + \beta_3*T_D + \beta_4*T_E + \beta_5*B_{II} + \beta_6*B_{III} + \beta_7*B_{IV} + \beta_8*B_{V} + \epsilon\]

\[\hat{Y} = \beta_0 + \beta_1*T_B + \beta_2*T_C + \beta_3*T_D + \beta_4*T_E + \beta_5*B_{II} + \beta_6*B_{III} + \beta_7*B_{IV} + \beta_8*B_{V}\]

summary(modelo.dbca)

Call:
lm(formula = rdt ~ trt + F, data = data)

Residuals:
    Min      1Q  Median      3Q     Max 
-5.0708 -1.0588 -0.0568  0.9452  3.0932 

Coefficients:
            Estimate Std. Error t value Pr(>|t|)    
(Intercept)   46.761      1.463  31.965 6.31e-16 ***
trtB           4.584      1.542   2.973  0.00898 ** 
trtC           8.594      1.542   5.573 4.20e-05 ***
trtD          12.034      1.542   7.804 7.64e-07 ***
trtE          11.744      1.542   7.616 1.04e-06 ***
FF2            2.152      1.542   1.396  0.18191    
FF3           -1.864      1.542  -1.209  0.24430    
FF4           -1.576      1.542  -1.022  0.32197    
FF5            3.154      1.542   2.045  0.05762 .  
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 2.438 on 16 degrees of freedom
Multiple R-squared:  0.8673,    Adjusted R-squared:  0.8009 
F-statistic: 13.07 on 8 and 16 DF,  p-value: 1.091e-05

Conclusión: Se concluye que los coeficientes \(\beta_0\), \(\beta_1\), \(\beta_2\), \(\beta_3\), \(\beta_4\) correspondientes a los tratamientos B, C, D y E, fueron estadísticamente distintos de 0. El ajuste del modelo descrito en el \(R^2\) fue de 0.8673, lo que quiere decir que el 86.73 % de la varianza del rendimiento está explicado por las variables Tratamiento y Bloque.

Verificación visual de los supuestos del modelo


performance::check_model(modelo.dbca)
ggResidpanel::resid_panel(modelo.dbca)
influence.measures(modelo.dbca)
Influence measures of
     lm(formula = rdt ~ trt + F, data = data) :

     dfb.1_  dfb.trtB  dfb.trtC  dfb.trtD  dfb.trtE   dfb.FF2   dfb.FF3
1   0.15756  1.22e-17  1.14e-16  1.42e-16  1.87e-01 -1.87e-01 -1.87e-01
2   0.10180 -5.86e-16 -4.83e-01 -1.36e-16 -2.29e-16 -4.83e-01 -2.34e-16
3   0.27601 -1.31e+00  4.35e-16 -1.58e-17 -3.10e-16  5.45e-16 -1.31e+00
4  -0.52203  6.19e-01  6.19e-01  6.19e-01  6.19e-01  8.66e-17  8.87e-17
5   0.04421 -4.06e-17 -7.51e-17 -2.10e-01  6.44e-18 -4.19e-17 -3.54e-17
6   0.19373 -1.02e-01 -1.02e-01 -1.02e-01 -1.02e-01 -1.02e-01 -1.02e-01
7   0.00235 -5.83e-18 -3.20e-18 -1.11e-02 -6.36e-19 -1.11e-02 -6.01e-18
8  -0.00949  1.09e-17  4.50e-02  5.01e-18  7.90e-19 -6.24e-18  4.50e-02
9  -0.01537  7.29e-02 -2.56e-17 -8.87e-18 -8.32e-18  8.30e-20  1.05e-17
10  0.09527  5.09e-17  4.38e-17  3.44e-17 -4.52e-01  1.48e-17 -9.49e-18
11 -0.15242  1.88e-17 -1.81e-01 -3.07e-17 -6.82e-17  1.81e-01  1.81e-01
12 -0.13938  6.61e-01 -3.25e-16 -2.88e-17 -9.28e-17  6.61e-01 -2.48e-17
13  0.04429 -9.20e-17 -1.05e-16 -2.10e-01 -4.52e-17 -5.83e-17 -2.10e-01
14  0.04421  2.32e-17  1.59e-17  4.78e-17 -2.10e-01 -1.10e-17 -1.50e-17
15 -0.08037  9.53e-02  9.53e-02  9.53e-02  9.53e-02 -5.35e-17 -4.42e-17
16 -0.20178 -2.39e-01 -3.60e-17 -5.88e-17 -9.03e-17  2.39e-01  2.39e-01
17  0.02018 -2.07e-17  1.61e-17  7.27e-18 -9.57e-02 -9.57e-02  2.62e-17
18  0.55752 -6.61e-01 -6.61e-01 -6.61e-01 -6.61e-01  6.88e-17  6.61e-01
19 -0.06416  5.35e-17  8.72e-17  3.04e-01  2.54e-17 -5.45e-18 -2.18e-17
20 -0.03922  1.94e-17  1.86e-01 -1.09e-17 -2.61e-17 -4.54e-17 -2.67e-17
21  0.10880  1.45e-17  1.29e-16  1.29e-01  7.42e-17 -1.29e-01 -1.29e-01
22 -0.03357  3.98e-02  3.98e-02  3.98e-02  3.98e-02 -3.98e-02  2.16e-18
23 -0.12456  8.59e-17  4.49e-17  1.35e-16  5.91e-01 -1.23e-16  5.91e-01
24 -0.08979  4.43e-17  4.26e-01 -8.42e-17 -4.86e-17 -1.12e-16 -9.16e-17
25 -0.12467  5.91e-01 -2.19e-16  1.02e-17 -8.30e-17  2.19e-16  3.17e-16
     dfb.FF4   dfb.FF5   dffit cov.r   cook.d  hat inf
1  -1.87e-01 -1.87e-01  0.3545 2.445 0.014677 0.36    
2  -7.70e-17 -5.30e-17 -0.9162 1.190 0.090477 0.36    
3   1.42e-16 -1.15e-16 -2.4841 0.020 0.422415 0.36   *
4  -6.19e-01  1.36e-16 -1.1746 0.715 0.140533 0.36    
5  -1.59e-17 -2.10e-01 -0.3979 2.363 0.018417 0.36    
6  -1.02e-01 -1.02e-01  0.1937 2.684 0.004428 0.36    
7  -6.39e-18 -6.85e-18 -0.0211 2.792 0.000053 0.36   *
8   9.21e-18  9.87e-18  0.0854 2.771 0.000863 0.36   *
9   7.29e-02 -3.20e-18  0.1384 2.737 0.002264 0.36   *
10  6.87e-17 -4.52e-01 -0.8574 1.317 0.080149 0.36    
11  1.81e-01  1.81e-01 -0.3430 2.466 0.013748 0.36    
12 -1.65e-17 -5.80e-17  1.2544 0.599 0.157182 0.36    
13  9.04e-19 -4.61e-17 -0.3986 2.361 0.018486 0.36    
14 -2.10e-01  9.20e-18 -0.3979 2.363 0.018417 0.36    
15 -5.07e-17 -9.53e-02 -0.1808 2.697 0.003861 0.36   *
16  2.39e-01  2.39e-01 -0.4540 2.248 0.023846 0.36    
17  4.07e-17  3.78e-17 -0.1816 2.697 0.003893 0.36   *
18  5.22e-17  2.90e-17  1.2544 0.599 0.157182 0.36    
19  3.04e-01  1.34e-17  0.5774 1.971 0.038015 0.36    
20  0.00e+00  1.86e-01  0.3530 2.448 0.014553 0.36    
21 -1.29e-01 -1.29e-01  0.2448 2.621 0.007052 0.36    
22 -1.28e-18  3.49e-18 -0.0755 2.776 0.000676 0.36   *
23 -1.85e-16 -7.78e-17  1.1211 0.800 0.129644 0.36    
24  4.26e-01  1.87e-17  0.8081 1.428 0.071842 0.36    
25  3.15e-16  5.91e-01  1.1220 0.799 0.129828 0.36    
influenceIndexPlot(modelo.dbca)

Cumplimiento de supuestos del modelo lineal general


Independencia de residuos

\(H_0: \text{Los residuos del rendimiento son completamente aleatorios e independientes}\)

\(H_1: \text{Los residuos del rendimiento no son completamente aleatorios e independientes}\)

durbinWatsonTest(modelo.dbca,
                 reps = 5000,
                 max.lag = 5)
 lag Autocorrelation D-W Statistic p-value
   1      0.43420856      1.039100  0.0628
   2      0.07029915      1.663034  0.7728
   3      0.03411753      1.382080  0.3752
   4     -0.02325324      1.406448  0.5528
   5      0.09013379      1.163374  0.0212
 Alternative hypothesis: rho[lag] != 0
dwtest(modelo.dbca, alternative = "two.sided")

    Durbin-Watson test

data:  modelo.dbca
DW = 1.0391, p-value = 0.07273
alternative hypothesis: true autocorrelation is not 0

Conclusión. A un nivel de significancia de 0.1, se concluye que existe suficiente evidencia estadística para rechazar la hipótesis nula, por lo tanto, los residuos del rendimiento no son completamente aleatorios e independientes.

Normalidad de residuos

\(H_0: \text{La distribución de los residuos del rendimiento es similar a la función normal}\)

\(H_1: \text{La distribución de los residuos del rendimiento es similar a la función normal}\)

shapiro.test(rstudent(modelo.dbca))

    Shapiro-Wilk normality test

data:  rstudent(modelo.dbca)
W = 0.93794, p-value = 0.1327
ad.test(rstudent(modelo.dbca))

    Anderson-Darling normality test

data:  rstudent(modelo.dbca)
A = 0.40488, p-value = 0.328
lillie.test(rstudent(modelo.dbca))

    Lilliefors (Kolmogorov-Smirnov) normality test

data:  rstudent(modelo.dbca)
D = 0.14105, p-value = 0.2245
ks.test(rstudent(modelo.dbca), "pnorm",
        alternative = "two.sided")

    Exact one-sample Kolmogorov-Smirnov test

data:  rstudent(modelo.dbca)
D = 0.11248, p-value = 0.8752
alternative hypothesis: two-sided
cvm.test(rstudent(modelo.dbca))

    Cramer-von Mises normality test

data:  rstudent(modelo.dbca)
W = 0.05227, p-value = 0.4635
pearson.test(rstudent(modelo.dbca))

    Pearson chi-square normality test

data:  rstudent(modelo.dbca)
P = 3.48, p-value = 0.6264
sf.test(rstudent(modelo.dbca))

    Shapiro-Francia normality test

data:  rstudent(modelo.dbca)
W = 0.93114, p-value = 0.08602

Conclusión. A un nivel de significancia de 0.1, se concluye que no existe suficiente evidencia estadística para rechazar la hipótesis nula, por lo tanto, la distribución de los residuos del rendimiento es similar a la función normal o gaussiana.

Homocedasticidad

\(H_0\): La varianza del rendimiento es constante con respecto a los valores ajustados del rendimiento.

\(H_1\): La varianza del rendimiento no es constante con respecto a los valores ajustados del rendimiento.

ncvTest(modelo.dbca)
Non-constant Variance Score Test 
Variance formula: ~ fitted.values 
Chisquare = 2.80928, Df = 1, p = 0.09372
bptest(modelo.dbca)

    studentized Breusch-Pagan test

data:  modelo.dbca
BP = 11.967, df = 8, p-value = 0.1527
bptest(modelo.dbca, studentize = F)

    Breusch-Pagan test

data:  modelo.dbca
BP = 12.691, df = 8, p-value = 0.1229
olsrr::ols_test_breusch_pagan(modelo.dbca)

 Breusch Pagan Test for Heteroskedasticity
 -----------------------------------------
 Ho: the variance is constant            
 Ha: the variance is not constant        

             Data               
 -------------------------------
 Response : rdt 
 Variables: fitted values of rdt 

        Test Summary          
 -----------------------------
 DF            =    1 
 Chi2          =    2.80928 
 Prob > Chi2   =    0.09372041 

Conclusión. A un nivel de significancia de 0.1, se concluye que no existe suficiente evidencia estadística para rechazar la hipótesis nula, por lo tanto, la varianza del rendimiento es constante con respecto a los valores ajustados del rendimiento.

Recomendación. Debido a que se cumple con el supuesto de homocedasticidad, para evaluar los efectos de los tratamientos con respecto al rendimiento, se debe proceder a realizar el análisis de varianza.

Prueba de linealidad y no aditividad

df = df.residual(modelo.dbca)
MSerror = deviance(modelo.dbca)/df.residual(modelo.dbca)
data %>% with(
  agricolae::nonadditivity(
    y = rdt,
    factor1 = trt,
    factor2 = `F`,
    df = df,
    MSerror = MSerror))

Tukey's test of nonadditivity
rdt 

P : -241.6241
Q : 8290.191 

Analysis of Variance Table

Response: residual
              Df Sum Sq Mean Sq F value Pr(>F)
Nonadditivity  1  7.042  7.0423  1.1994 0.2907
Residuals     15 88.069  5.8713               
$P
Nonadditivity 
    -241.6241 

$Q
Nonadditivity 
     8290.191 

$ANOVA
Analysis of Variance Table

Response: residual
              Df Sum Sq Mean Sq F value Pr(>F)
Nonadditivity  1  7.042  7.0423  1.1994 0.2907
Residuals     15 88.069  5.8713               

Estadísticas globales

modelo.dbca %>% gvlma()

Call:
lm(formula = rdt ~ trt + F, data = data)

Coefficients:
(Intercept)         trtB         trtC         trtD         trtE          FF2  
     46.761        4.584        8.594       12.034       11.744        2.152  
        FF3          FF4          FF5  
     -1.864       -1.576        3.154  


ASSESSMENT OF THE LINEAR MODEL ASSUMPTIONS
USING THE GLOBAL TEST ON 4 DEGREES-OF-FREEDOM:
Level of Significance =  0.05 

Call:
 gvlma(x = .) 

                     Value p-value                Decision
Global Stat        2.94984  0.5663 Assumptions acceptable.
Skewness           0.54384  0.4608 Assumptions acceptable.
Kurtosis           0.01525  0.9017 Assumptions acceptable.
Link Function      1.85107  0.1737 Assumptions acceptable.
Heteroscedasticity 0.53969  0.4626 Assumptions acceptable.

Análisis de varianza

\[Y = \mu + \tau_{i} + \beta_{j} + \epsilon_{ij}\]

\[\hat{Y} = \mu + \tau_{i} + \beta_{j}\]

Para los tratamientos:

\(H_0: \tau_{A} = \tau_{B} = \tau_{C} = \tau_{D} = \tau_{E} = 0\)

\(H_1: \text{En al menos un tratamiento el } \tau \text{ es diferente a los demás.}\)

\(H_1: \tau_i \neq 0\text{; en al menos un tratamiento.}\)

Para los bloques:

\(H_0: \beta_{I} = \beta_{II} = \beta_{III} = \beta_{IV} = \beta_{V} = 0\)

\(H_1: \text{En al menos un bloque el } \beta \text{ es diferente a los demás.}\)

\(H_1: \beta_j \neq 0\text{; en al menos un bloque.}\)

anova(modelo.dbca, test = "F")
Analysis of Variance Table

Response: rdt
          Df Sum Sq Mean Sq F value    Pr(>F)    
trt        4 522.30 130.574 21.9656 2.464e-06 ***
F          4  99.20  24.801  4.1721   0.01675 *  
Residuals 16  95.11   5.944                      
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
qf(0.95, 4, 16)
[1] 3.006917
shadeDist(qf(0.95, 4, 16), "df",4, 16, lower.tail = F)

Conclusión. A un nivel de significancia de 0.05, se concluye que existe suficiente evidencia estadística para rechazar la hipótesis nula, por lo tanto, al menos un tratamiento tiene un efecto sobre el rendimiento estadísticamente diferente del resto de tratamientos.

agricolae::cv.model(modelo.dbca)
[1] 4.471568

Comparaciones de medias

  • A vs B:

\(H_0: \mu_{A} - \mu_{B} = 0\)

\(H_1: \mu_{A} - \mu_{B} \neq 0\)

  • A vs C:

\(H_0: \mu_{A} - \mu_{C} = 0\)

\(H_1: \mu_{A} - \mu_{C} \neq 0\)

  • A vs D:

\(H_0: \mu_{A} - \mu_{D} = 0\)

\(H_1: \mu_{A} - \mu_{D} \neq 0\)

  • A vs E:

\(H_0: \mu_{A} - \mu_{E} = 0\)

\(H_1: \mu_{A} - \mu_{E} \neq 0\)

  • B vs C:

\(H_0: \mu_{B} - \mu_{C} = 0\)

\(H_1: \mu_{B} - \mu_{C} \neq 0\)

  • B vs D:

\(H_0: \mu_{B} - \mu_{D} = 0\)

\(H_1: \mu_{B} - \mu_{D} \neq 0\)

  • B vs E:

\(H_0: \mu_{B} - \mu_{E} = 0\)

\(H_1: \mu_{B} - \mu_{E} \neq 0\)

  • C vs D:

\(H_0: \mu_{C} - \mu_{D} = 0\)

\(H_1: \mu_{C} - \mu_{D} \neq 0\)

  • C vs E:

\(H_0: \mu_{C} - \mu_{E} = 0\)

\(H_1: \mu_{C} - \mu_{E} \neq 0\)

  • D vs E:

\(H_0: \mu_{D} - \mu_{E} = 0\)

\(H_1: \mu_{D} - \mu_{E} \neq 0\)

Prueba de HSD (Honestamente significativa -> Tukey)

agricolae::HSD.test(modelo.dbca, trt = "trt", alpha = 0.05,
         group = TRUE, main = NULL, console = TRUE)

Study: modelo.dbca ~ "trt"

HSD Test for rdt 

Mean Square Error:  5.944484 

trt,  means

     rdt      std r   Min   Max
A 47.134 2.840129 5 42.26 49.43
B 51.718 5.324328 5 44.41 57.31
C 55.728 2.229747 5 53.72 59.45
D 59.168 2.065798 5 55.87 60.89
E 58.878 1.710181 5 55.87 60.17

Alpha: 0.05 ; DF Error: 16 
Critical Value of Studentized Range: 4.332688 

Minimun Significant Difference: 4.724213 

Treatments with the same letter are not significantly different.

     rdt groups
D 59.168      a
E 58.878      a
C 55.728     ab
B 51.718     bc
A 47.134      c
agricolae::HSD.test(modelo.dbca, trt = "trt", alpha = 0.05,
         group = FALSE, main = NULL, console = TRUE)

Study: modelo.dbca ~ "trt"

HSD Test for rdt 

Mean Square Error:  5.944484 

trt,  means

     rdt      std r   Min   Max
A 47.134 2.840129 5 42.26 49.43
B 51.718 5.324328 5 44.41 57.31
C 55.728 2.229747 5 53.72 59.45
D 59.168 2.065798 5 55.87 60.89
E 58.878 1.710181 5 55.87 60.17

Alpha: 0.05 ; DF Error: 16 
Critical Value of Studentized Range: 4.332688 

Comparison between treatments means

      difference pvalue signif.        LCL        UCL
A - B     -4.584 0.0594       .  -9.308213  0.1402129
A - C     -8.594 0.0004     *** -13.318213 -3.8697871
A - D    -12.034 0.0000     *** -16.758213 -7.3097871
A - E    -11.744 0.0000     *** -16.468213 -7.0197871
B - C     -4.010 0.1173          -8.734213  0.7142129
B - D     -7.450 0.0015      ** -12.174213 -2.7257871
B - E     -7.160 0.0022      ** -11.884213 -2.4357871
C - D     -3.440 0.2182          -8.164213  1.2842129
C - E     -3.150 0.2909          -7.874213  1.5742129
D - E      0.290 0.9997          -4.434213  5.0142129

Nota: Todos aquellos tratamientos que compartan por lo menos una letra serán estadísticamente similares.

Recomendación: Se debe usar la prueba de Tukey cuando como máximo se tenga 6 tratamientos.

Prueba de Duncan

agricolae::duncan.test(modelo.dbca, trt = "trt", 
                       alpha = 0.05, group = TRUE, 
                       main = NULL, console = TRUE)

Study: modelo.dbca ~ "trt"

Duncan's new multiple range test
for rdt 

Mean Square Error:  5.944484 

trt,  means

     rdt      std r   Min   Max
A 47.134 2.840129 5 42.26 49.43
B 51.718 5.324328 5 44.41 57.31
C 55.728 2.229747 5 53.72 59.45
D 59.168 2.065798 5 55.87 60.89
E 58.878 1.710181 5 55.87 60.17

Alpha: 0.05 ; DF Error: 16 

Critical Range
       2        3        4        5 
3.268914 3.427893 3.527272 3.595419 

Means with the same letter are not significantly different.

     rdt groups
D 59.168      a
E 58.878     ab
C 55.728      b
B 51.718      c
A 47.134      d
agricolae::duncan.test(modelo.dbca, trt = "trt", 
                       alpha = 0.05, group = FALSE, 
                       main = NULL, console = TRUE)

Study: modelo.dbca ~ "trt"

Duncan's new multiple range test
for rdt 

Mean Square Error:  5.944484 

trt,  means

     rdt      std r   Min   Max
A 47.134 2.840129 5 42.26 49.43
B 51.718 5.324328 5 44.41 57.31
C 55.728 2.229747 5 53.72 59.45
D 59.168 2.065798 5 55.87 60.89
E 58.878 1.710181 5 55.87 60.17

Comparison between treatments means

      difference pvalue signif.        LCL         UCL
A - B     -4.584 0.0090      **  -7.852914 -1.31508590
A - C     -8.594 0.0001     *** -12.021893 -5.16610657
A - D    -12.034 0.0000     *** -15.629419 -8.43858057
A - E    -11.744 0.0000     *** -15.271272 -8.21672833
B - C     -4.010 0.0193       *  -7.278914 -0.74108590
B - D     -7.450 0.0003     *** -10.977272 -3.92272833
B - E     -7.160 0.0004     *** -10.587893 -3.73210657
C - D     -3.440 0.0493       *  -6.867893 -0.01210657
C - E     -3.150 0.0579       .  -6.418914  0.11891410
D - E      0.290 0.8532          -2.978914  3.55891410

Nota: La prueba de Duncan usa múltiples valores críticos.

Recomendación: No usar la prueba de Duncan cuando se presentan resultados con múltiples tratamientos que obtengan varias significancias.

Prueba de Student - Newman -Keuls

agricolae::SNK.test(modelo.dbca, trt = "trt", 
                       alpha = 0.05, group = TRUE, 
                       main = NULL, console = TRUE)

Study: modelo.dbca ~ "trt"

Student Newman Keuls Test
for rdt 

Mean Square Error:  5.944484 

trt,  means

     rdt      std r   Min   Max
A 47.134 2.840129 5 42.26 49.43
B 51.718 5.324328 5 44.41 57.31
C 55.728 2.229747 5 53.72 59.45
D 59.168 2.065798 5 55.87 60.89
E 58.878 1.710181 5 55.87 60.17

Alpha: 0.05 ; DF Error: 16 

Critical Range
       2        3        4        5 
3.268914 3.978895 4.411720 4.724213 

Means with the same letter are not significantly different.

     rdt groups
D 59.168      a
E 58.878      a
C 55.728      a
B 51.718      b
A 47.134      c
agricolae::SNK.test(modelo.dbca, trt = "trt", 
                       alpha = 0.05, group = FALSE, 
                       main = NULL, console = TRUE)

Study: modelo.dbca ~ "trt"

Student Newman Keuls Test
for rdt 

Mean Square Error:  5.944484 

trt,  means

     rdt      std r   Min   Max
A 47.134 2.840129 5 42.26 49.43
B 51.718 5.324328 5 44.41 57.31
C 55.728 2.229747 5 53.72 59.45
D 59.168 2.065798 5 55.87 60.89
E 58.878 1.710181 5 55.87 60.17

Comparison between treatments means

      difference pvalue signif.        LCL        UCL
A - B     -4.584 0.0090      **  -7.852914 -1.3150859
A - C     -8.594 0.0001     *** -12.572895 -4.6151052
A - D    -12.034 0.0000     *** -16.758213 -7.3097871
A - E    -11.744 0.0000     *** -16.155720 -7.3322802
B - C     -4.010 0.0193       *  -7.278914 -0.7410859
B - D     -7.450 0.0010     *** -11.861720 -3.0382802
B - E     -7.160 0.0007     *** -11.138895 -3.1811052
C - D     -3.440 0.0961       .  -7.418895  0.5388948
C - E     -3.150 0.0579       .  -6.418914  0.1189141
D - E      0.290 0.8532          -2.978914  3.5589141

Prueba de Least significant difference

agricolae::LSD.test(modelo.dbca, trt = "trt", 
                       alpha = 0.05, group = TRUE, 
                       main = NULL, console = TRUE)

Study: modelo.dbca ~ "trt"

LSD t Test for rdt 

Mean Square Error:  5.944484 

trt,  means and individual ( 95 %) CI

     rdt      std r      LCL      UCL   Min   Max
A 47.134 2.840129 5 44.82253 49.44547 42.26 49.43
B 51.718 5.324328 5 49.40653 54.02947 44.41 57.31
C 55.728 2.229747 5 53.41653 58.03947 53.72 59.45
D 59.168 2.065798 5 56.85653 61.47947 55.87 60.89
E 58.878 1.710181 5 56.56653 61.18947 55.87 60.17

Alpha: 0.05 ; DF Error: 16
Critical Value of t: 2.119905 

least Significant Difference: 3.268914 

Treatments with the same letter are not significantly different.

     rdt groups
D 59.168      a
E 58.878     ab
C 55.728      b
B 51.718      c
A 47.134      d
agricolae::LSD.test(modelo.dbca, trt = "trt", 
                       alpha = 0.05, group = FALSE, 
                       main = NULL, console = TRUE)

Study: modelo.dbca ~ "trt"

LSD t Test for rdt 

Mean Square Error:  5.944484 

trt,  means and individual ( 95 %) CI

     rdt      std r      LCL      UCL   Min   Max
A 47.134 2.840129 5 44.82253 49.44547 42.26 49.43
B 51.718 5.324328 5 49.40653 54.02947 44.41 57.31
C 55.728 2.229747 5 53.41653 58.03947 53.72 59.45
D 59.168 2.065798 5 56.85653 61.47947 55.87 60.89
E 58.878 1.710181 5 56.56653 61.18947 55.87 60.17

Alpha: 0.05 ; DF Error: 16
Critical Value of t: 2.119905 

Comparison between treatments means

      difference pvalue signif.        LCL        UCL
A - B     -4.584 0.0090      **  -7.852914 -1.3150858
A - C     -8.594 0.0000     *** -11.862914 -5.3250858
A - D    -12.034 0.0000     *** -15.302914 -8.7650858
A - E    -11.744 0.0000     *** -15.012914 -8.4750858
B - C     -4.010 0.0193       *  -7.278914 -0.7410858
B - D     -7.450 0.0002     *** -10.718914 -4.1810858
B - E     -7.160 0.0003     *** -10.428914 -3.8910858
C - D     -3.440 0.0404       *  -6.708914 -0.1710858
C - E     -3.150 0.0579       .  -6.418914  0.1189142
D - E      0.290 0.8532          -2.978914  3.5589142